package net.zisen.cloud.core.security.adive;

import net.zisen.cloud.base.msg.ResultMsg;
import org.apache.shiro.ShiroException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.http.HttpStatus;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.ResponseStatus;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author tim/278002989@qq.com
 * @Classname AuthCtrl
 * @Description TODO
 * @Date 2019-04-01 23:46
 */
@RestController
public class AuthCtrl {

    private final Logger log = LoggerFactory.getLogger(this.getClass());

    @RequestMapping(value = "401")
    @ResponseBody
    @ResponseStatus(HttpStatus.UNAUTHORIZED)
    public ResultMsg handle401Error(ShiroException e) {
        log.debug("ShiroException");
        log.error("ShiroException");
        return new ResultMsg(false, 401, "尚未登录");
    }

}
